#ifndef _VN_CAMERA_H_
#define _VN_CAMERA_H_

#include "..\Math\Vector2.h"
#include "Rect.h"
#include "..\ScaleFactor.h"
#include "..\Define.h"

namespace vn
{
	class Camera
	{
	public:
		Camera(void) : m_freeMovement(true), m_velocity(0.0f) 
		{ m_cameraSize = vn::FloatRect(0,0, VSW, VSH); }
		virtual ~Camera(void){}

		virtual void zoom(float) = 0;
		virtual void setRotation(float) = 0;

		void setBoundary(const vn::FloatRect& p_boundary) { m_boundary = p_boundary; }
		void setBoundary(float p_x, float p_y, float p_w, float p_h) { m_boundary.x = p_x; m_boundary.y = p_y; m_boundary.w = p_w; m_boundary.h = p_h; }
		void setCameraSize(const vn::FloatRect& p_cameraSize) { m_cameraSize = p_cameraSize; }
		void setCameraSize(float p_x, float p_y, float p_w, float p_h) { m_cameraSize.x = p_x; m_cameraSize.y = p_y; m_cameraSize = p_w; m_cameraSize = p_h; }
		void setFreeMovement(bool p_value) { m_freeMovement = p_value; }	// if false the camera will move within it's set boundary
		void setVelocity(float p_velocity) { m_velocity = p_velocity; }
		void setLevelSize(float p_x, float p_y, float p_w, float p_h) { m_levelSize.x = p_x; m_levelSize.y = p_y; m_levelSize.w = p_w; m_levelSize.h = p_h; }
		void setLevelSize(const vn::FloatRect& p_levelSize) { m_levelSize = p_levelSize; }

		void setTarget(const vn::Vector2& p_target) {m_target.x = p_target.x; m_target.y = p_target.y; }
		void setTarget(float p_x, float p_y) { m_target.x = p_x; m_target.y = p_y; }
		void setPosition(const vn::Vector2& p_position) { m_position.x = p_position.x; m_position.y = p_position.y; m_target.x = p_position.x; m_target.y = p_position.y; }
		void setPosition(float p_x, float p_y) { m_position.x = p_x; m_position.y = p_y; m_target.x = p_x; m_target.y = p_y; }

		const vn::Vector2& getPosition() const { return m_position; }
		const vn::Vector2& getTarget() const { return m_target; }
		const vn::FloatRect& getBoundary() const { return m_boundary; }
		const vn::FloatRect& getLevelSize() const { return m_levelSize; }
		
	protected:
		virtual void update() = 0;
		

		vn::Vector2 m_position;
		vn::Vector2 m_target;
		vn::FloatRect m_levelSize;
		vn::FloatRect m_cameraSize;
		vn::FloatRect m_boundary;
		bool m_freeMovement;
		float m_velocity;
	};
}

#endif // _VN_CAMERA_H_